package practice;

import practice.domain.Person;

import java.lang.reflect.Method;

public class 通过反射操作普通方法 {
    public static void main(String[] args) throws Exception {
        Class clazz = Person.class;
        Person person = new Person();

        Method method1 = clazz.getDeclaredMethod("eat", String.class);
        method1.setAccessible(true);
        method1.invoke(person,"shit");

        Method method2 = clazz.getDeclaredMethod("play", String.class);
        method2.setAccessible(true);
        method2.invoke(person,"horizon4");


    }
}
